//
// Autor:   Mauro Enrique de Souza Munoz,  RA: 911472.
//
// Arquivo: saveable.hh
//
// Classe:  TSaveable.
//
// Descr.:  Classe base para todos objetos que quiserem usufruir do
//          Communication Manager (ver "communic.hh")
//
// Versao:  02 / 04 / 96.
//
#ifndef _SAVEABLEHH_
#define _SAVEABLEHH_
#include <stdio.h>
#include <string>
#include <iostream>

#include "oopstorage.h"
#include "cmdefs.h"
#include "oopobjectid.h"

class   OOPDataVersion;
using namespace std;
/**
 * Base class for any class subjected to parallelization.
 * Implements basic functionalities for a parallel environment such as Packing and Unpacking.
 * Its virtual methods makes all derived classes compliant with the communication protocol
 * stablished by the OOPar.
 */
class   OOPSaveable
{
      public:
  /**
   * Simple Constructor 
   */
	OOPSaveable ()
	{
	}
  /**
   * Simple Desctructor 
   */
	virtual ~ OOPSaveable ()
	{
	}
  /**
   * Returns a Class ID identifier
   */
  virtual long GetClassID () 
  {
    return -1;
  }
  /**
   * Packs the object in on the buffer so it can be transmitted through the network.
   * The Pack function  packs the object's class_id while function Unpack() doesn't,
   * allowing the user to identify the next object to be unpacked.
   * @param *buff A pointer to TSendStorage class to be packed.
   */
	virtual int Pack (OOPStorageBuffer * buf);
  /**
   * Unpacks the object class_id
   * @param *buff A pointer to TSendStorage class to be unpacked.
   */
	virtual int Unpack (OOPStorageBuffer * buf);
 
static OOPSaveable *Restore(OOPStorageBuffer *buf);
};
#endif // _SAVEABLEHH_
